digest and hmac: drop intermediate builder and directly take slices for input#766
digest and hmac: drop intermediate builder and directly take slices for input#766Tpt wants to merge 2 commits into
Conversation
…or input It removes the need for intermediate traits. All callers can easily build a slice of slices but the S3 object content SHA 256 computation that is expensive anyway.
Co-authored-by: Kevin Liu <kevinjqliu@users.noreply.github.com>
alamb
left a comment
There was a problem hiding this comment.
Thanks @Tpt and @kevinjqliu
| /// Finalizes the digest calculation and returns the digest value. | ||
| /// | ||
| /// It is implementation-defined behaviour to call this after calling [`Self::finish`] | ||
| fn finish(&mut self) -> Result<&[u8]>; |
There was a problem hiding this comment.
We could possibly have a smaller API change and just allow the traits to return a Vec directly 🤔 that would also avoid the need for a copy in some cases and might be a smaller API change?
fn build(self) -> Result<Vec<u8>> {
...
}There was a problem hiding this comment.
Thank you for the review!
All digests are currently stored in fixed length arrays so it would not save any allocation in our case, just a possible memcopy at the cost of maybe a useless allocations.
On the breaking changes, I hoped that this changed would be reviewed before the release, seems it's not the case sadly. I just found quite sad to have a complicated API with a lot of dynamic traits where a smaller API could work. Feel free to close this MR.
|
btw ci issue is from docker failing
EDIT: #776 should fix this going forward |
It removes the need for intermediate traits.
All callers can easily build a slice of slices but the S3 object content SHA 256 computation that is expensive anyway.
Follow up to #707